package main

import (
	"common/config"
	"flag"
	"fmt"
	"go.uber.org/zap"
	"google.golang.org/grpc"
	"net"
	_ "ticket_srv/initialization"
	"ticket_srv/internal/server"
	pb "ticket_srv/proto"
)

var port = flag.Int(config.Configs.SyStem.Name, config.Configs.SyStem.Port, "The server port")

func main() {
	flag.Parse()
	lis, _ := net.Listen("tcp", fmt.Sprintf(":%v", *port))
	s := grpc.NewServer()
	pb.RegisterTicketServer(s, &server.Server{})
	zap.S().Infof("server listening at %v", lis.Addr())
	if err := s.Serve(lis); err != nil {
		zap.S().Errorf("Failed server %v", err.Error())
	}
}
